package com.nacrtstudio.webgiftshop.components;

import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.SymbolConstants;

@Import(stylesheet={
        "classpath:/com/trsvax/bootstrap/assets/bootstrap/css/bootstrap.css",
        "classpath:/com/trsvax/bootstrap/assets/bootstrap/css/bootstrap-responsive.css",
        "context:/adminLayout/layout.css"
        },
library={
        "classpath:/com/trsvax/bootstrap/assets/bootstrap/js/bootstrap.js"
		}
)
public class AdminLayout {
	@Property
    @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
    private String title;

    @Property
    private String pageName;

    @Property
    @Parameter(defaultPrefix = BindingConstants.LITERAL)
    private String sidebarTitle;

    @Property
    @Parameter(defaultPrefix = BindingConstants.LITERAL)
    private Block sidebar;

    @Inject
    private ComponentResources resources;

    @Property
    @Inject
    @Symbol(SymbolConstants.APPLICATION_VERSION)
    private String appVersion;


    public String getClassForPageName()
    {
        return resources.getPageName().equalsIgnoreCase(pageName)
                ? "current_page_item"
                : null;
    }

    public String[] getPageCatalogNames()
    {
        return new String[]{"admin/Catalog","admin/AllCategories", "admin/AddNewGift"};
    }
    public String getFixedPageNames(){
    	if (pageName == "admin/Catalog") {
			return "Show Gift Catalog";
		} else if(pageName == "admin/AllCategories"){
			return "Categories";
		} else if(pageName == "admin/AddNewGift"){
			return "New Gift";
		} else if(pageName == "admin/OrderReports"){
			return "Order Reports";
		} else if(pageName == "admin/PackedGifts"){
			return "Packed Gifts";
		} else if(pageName == "admin/EditAbout"){
			return "About";
		} else if(pageName == "admin/EditInstructions"){
			return "Instructions";
		} else if(pageName == "admin/EditFaq"){
			return "FAQ";
		}
    	return pageName;
    }
    public String[] getPageReportsNames()
    {
        return new String[]{"admin/OrderReports","admin/PackedGifts"};
    }
    public String[] getPageCmsNames()
    {
        return new String[]{"admin/EditAbout", "admin/EditInstructions", "admin/EditFaq"};
    }
}
